﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddNews.aspx.cs" Inherits="Sbook.AdminIstrator.AddNews" ValidateRequest="false" %>

<%@ Register src="ControlAdmin/MenuLeft.ascx" tagname="MenuLeft" tagprefix="uc1" %>

<%@ Register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %>

<%@ Register src="ControlAdmin/ucLogout.ascx" tagname="ucLogout" tagprefix="uc2" %>
<%@ Register Src="ControlAdmin/MenuTop.ascx" TagName="MenuTop" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Manager News</title>
    <link href="style.css" rel="stylesheet" type="text/css" />

<script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/ddaccordion.js"></script>
<script type="text/javascript">
    ddaccordion.init({
        headerclass: "submenuheader", //Shared CSS class name of headers group
        contentclass: "submenu", //Shared CSS class name of contents group
        revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
        mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
        collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
        defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
        onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
        animatedefault: false, //Should contents open by default be animated into view?
        persiststate: true, //persist state of opened contents within browser session?
        toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
        togglehtml: ["suffix", "<img src='images/plus.gif' class='statusicon' />", "<img src='images/minus.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
        animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
        oninit: function (headers, expandedindices) { //custom code to run when headers have initalized
            //do nothing
        },
        onopenclose: function (header, index, state, isuseractivated) { //custom code to run whenever a header is opened or closed
            //do nothing
        }
    })
</script>
<script src="js/jquery.jclock-1.2.0.js.txt" type="text/javascript"></script>
<script type="text/javascript" src="js/jconfirmaction.jquery.js"></script>
<script type="text/javascript">

    $(document).ready(function () {
        $('.ask').jConfirmAction();
    });
	
</script>
<script type="text/javascript">
    $(function ($) {
        $('.jclock').jclock();
    });


</script>

     

<script language="javascript" type="text/javascript" src="js/niceforms.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="css/niceforms-default.css" />

    <style type="text/css">
        .style1
        {
            height: 86px;
        }
    </style>

</head>
<body>
<form runat="server" id="form1">
<div id="main_container">
    
	<div class="header">
    <div class="logo"><a href="adminsys.aspx"><img alt="" src="../images/logo_sach.gif" width="130" height="100" border="0" /></a></div>
    
    <div class="right_header">Welcome Admin | <uc2:ucLogout ID="ucLogout1" runat="server" />
        </div>
    <div class="jclock"></div>
    </div>
    
    <div class="main_content">
    
   <uc1:MenuTop runat="server" ID="menuTop" />
                    
    <div class="center_content">  
    
       <uc1:MenuLeft 
            ID="MenuLeft1" runat="server" />
&nbsp;<div class="right_content">            
        <h2>Manager News</h2>
    <asp:LinkButton ID="lbtEditNews" runat="server" Font-Bold="True" Font-Underline="False" 
                onclick="lbtEditNews_Click">Edit News</asp:LinkButton> ||
    <asp:LinkButton ID="lbtEditNewsGroup" runat="server" Font-Bold="True" 
                Font-Underline="False" onclick="lbtEditNewsGroup_Click">Edit News Group</asp:LinkButton>
                <br /><br /><br />
    <asp:Panel ID="pnViewNewsGroup" runat="server" Visible="false">
    <asp:DataGrid ID="grdNewsGroup" runat="server" AutoGenerateColumns="False" 
            BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" 
            CellPadding="4" Width="228px" onitemcommand="grdNewsGroup_ItemCommand" 
            AllowPaging="True" onpageindexchanged="grdNewsGroup_PageIndexChanged" 
            PageSize="5">
        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
        <ItemStyle BackColor="White" ForeColor="#003399" />
        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" 
            Mode="NumericPages" />
        <SelectedItemStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
        <Columns>
             <asp:TemplateColumn ItemStyle-HorizontalAlign="Center" Visible="true">
                        <HeaderTemplate>Chọn</HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox runat="server" ID="chkSelect"  />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:BoundColumn DataField="GroupID" HeaderText="ID" Visible="false"></asp:BoundColumn>
                    <asp:BoundColumn DataField="GroupName" HeaderText="Nhóm tin" Visible="true"></asp:BoundColumn>
                    <asp:BoundColumn DataField="gStatus" HeaderText="Trạng thái" Visible="true"></asp:BoundColumn>
                    
                    <asp:TemplateColumn>
                        <HeaderTemplate>Chức năng</HeaderTemplate>
                        <ItemTemplate>
                            <asp:LinkButton runat="server" ID="lbtEdit" Text="Edit" CommandName="Edit" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"GroupID") %>'></asp:LinkButton>
                             <asp:LinkButton runat="server" ID="lbtDelete" Text="Delete" OnClientClick="javascript:return confirm('Các tin thuộc nhóm tin này sẽ bị xóa! Bạn muốn xóa?');" CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"GroupID") %>'></asp:LinkButton>
                            <asp:LinkButton runat="server" ID="lbtActive" Text=""  CommandName="Active" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"GroupID") %>'></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateColumn>
        </Columns>
    </asp:DataGrid>
        <asp:Button ID="btnAddNewsGroup" runat="server" Text="Add" 
            onclick="btnAddNewsGroup_Click" />    
        <asp:Button ID="btnDeleteNewsGroup" runat="server" Text="Delete Selection" 
            onclick="btnDeleteNewsGroup_Click" OnClientClick="javascript:return confirm('Các tin thuộc các nhóm bị xóa cũng sẽ bị xóa! Bạn chắc chắn muốn xóa?');" />
    </asp:Panel>
    <asp:Panel ID="pnAddNewsGroup" runat="server" Visible="false">
        <table style="width: 100%;">
            <tr>
                <td width="10%">
                    &nbsp;
                    <asp:Label ID="Label6" runat="server" Text="Group Name"></asp:Label>
                </td>
                <td>
                    &nbsp;
                    <asp:TextBox ID="txtGroupName" runat="server" Width="307px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                    <asp:Label ID="Label7" runat="server" Text="Status"></asp:Label>
                </td>
                <td>
                    &nbsp;
                    <asp:CheckBox ID="chkGStatus" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    &nbsp;
                    <asp:Button ID="btnSaveGroup" runat="server" Text="Save" 
                        onclick="btnSaveGroup_Click" />
                </td>
                <td>
                    &nbsp;
                </td>
            </tr>
        </table>
    </asp:Panel>
        <asp:Panel ID="pnViewNews" runat="server" Visible="False">
                <asp:DropDownList ID="ddlSelectGroup" runat="server" AutoPostBack="True" 
            onselectedindexchanged="ddlSelectGroup_SelectedIndexChanged">
        </asp:DropDownList>
    
        <asp:DataGrid ID="grdNews" runat="server" BackColor="White" BorderColor="#3366CC" AutoGenerateColumns="false"
                BorderStyle="None" BorderWidth="1px" CellPadding="4" 
                onitemcommand="grdNews_ItemCommand" AllowPaging="True" 
                onpageindexchanged="grdNews_PageIndexChanged" PageSize="5">
            <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
            <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
            <ItemStyle BackColor="White" ForeColor="#003399" />
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" 
                Mode="NumericPages" />
            <SelectedItemStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
            <Columns>
                <asp:TemplateColumn ItemStyle-HorizontalAlign="Center">
                        <HeaderTemplate>Chọn</HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox runat="server" ID="chkSelect"  />
                        </ItemTemplate>
                    </asp:TemplateColumn>
                    <asp:BoundColumn DataField="NId" HeaderText="ID" Visible="false"></asp:BoundColumn>
                    <asp:BoundColumn DataField="NTitle" HeaderText="Title" Visible="true"></asp:BoundColumn>
                    <asp:BoundColumn DataField="NDescription" HeaderText="Mô tả" Visible="true"></asp:BoundColumn>
                    
                    <asp:BoundColumn DataField="NDate" HeaderText="Thời gian" ItemStyle-HorizontalAlign="Right" Visible="true"></asp:BoundColumn>
                    <asp:BoundColumn DataField="GroupID" HeaderText="Nhóm" ItemStyle-HorizontalAlign="Center" Visible="true"></asp:BoundColumn>
                    <asp:BoundColumn DataField="NStatus" HeaderText="Trạng thái" ItemStyle-HorizontalAlign="Center" Visible="true"></asp:BoundColumn>
                    
                    <asp:TemplateColumn>
                        <HeaderTemplate>Chức năng</HeaderTemplate>
                        <ItemTemplate>
                            <asp:LinkButton runat="server" ID="lbtEdit" Text="Edit" CommandName="Edit" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"NId") %>'></asp:LinkButton>
                            <asp:LinkButton runat="server" ID="lbtDelete" Text="Delete" OnClientClick="javascript:return confirm('Bạn muốn xóa?');" CommandName="Delete" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"NId") %>'></asp:LinkButton>
                            <asp:LinkButton runat="server" ID="lbtActive" Text=""  CommandName="Active" CommandArgument='<%#DataBinder.Eval(Container.DataItem,"NId") %>'></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateColumn>
            </Columns>
        </asp:DataGrid>
   
            <asp:Button ID="btnAdd" runat="server" onclick="btnAdd_Click" Text="Add" />
            <asp:Button ID="btnDelete" runat="server" Text="Delete" 
                onclick="btnDelete_Click" />
            <br />
</asp:Panel>
    <asp:Panel ID="pnAddNews" runat="server" Visible="False">
        <table style="width:100%;">
            <tr>
                <td width="10%">
                    <asp:Label ID="Label1" runat="server" Text="Title"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtTitle" runat="server" Width="406px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label2" runat="server" Text="Description"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtDescription" runat="server" Height="71px" 
                        TextMode="MultiLine" Width="405px"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="style1">
                    <asp:Label ID="Label3" runat="server" Text="Content"></asp:Label>
                </td>
                <td class="style1">
                    <FCKeditorV2:FCKeditor ID="fckContent" runat="server" 
                        BasePath="/scripts/">
                    </FCKeditorV2:FCKeditor>
                    
                </td>
            </tr>
            <tr>
                <td class="style1">
                    <asp:Label ID="Label8" runat="server" Text="Image"></asp:Label>
                </td>
                <td class="style1">
                    <asp:FileUpload ID="fuImage" runat="server" Width="213px" />
                    <asp:Label ID="lblFile" runat="server" Visible="False"></asp:Label>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label4" runat="server" Text="Status"></asp:Label>
                </td>
                <td>
                    <asp:CheckBox ID="chkStatus" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label5" runat="server" Text="Group"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlGroup" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="btnSave" runat="server" onclick="btnSave_Click" Text="Save" />
                </td>
                <td>
                    <asp:Button ID="btnBack" runat="server" onclick="btnBack_Click" Text="Back" />
                </td>
            </tr>
        </table>

    </asp:Panel>
    </div>
    <!-- end of right content-->
            
                    
  </div>   <!--end of center content -->               
                    
                    
    
    
    <div class="clear"></div>
    </div> <!--end of main content-->
	
    
    <div class="footer">
    
    	<div class="left_footer">SBooks 2012<a href="http://indeziner.com"></a></div>
    </div>

</div>	

</form>
</body>
</html>
